import type { IExample } from '@/api/example';
import Mock from 'mockjs';
import setupMock, { successResponseWrap } from './setup-mock';

setupMock({
  setup() {
    Mock.mock(new RegExp('/api/example-table'), () => {
      let tableData: IExample.ITableResponse[] = [];

      let count = 20;

      tableData = new Array(count).fill('').map((item, index) => ({
        id: `${item + 1}`,
        column1: `第${item + 1}列的第${index + 1}条数据`,
        column2: `第${item + 2}列的第${index + 1}条数据`,
        column3: `第${item + 3}列的第${index + 1}条数据`,
        column4: `第${item + 4}列的第${index + 1}条数据`,
        column5: `第${item + 5}列的第${index + 1}条数据`,
      }));
      return successResponseWrap({
        records: tableData,
        total: tableData.length,
        current: 1,
        size: 20,
      });
    });
  },
});
